﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using XingLucifer.IBase.Enums;

namespace XingLucifer.IBase
{
    /// <summary>
    /// 设备通信接口
    /// </summary>
    public interface IDevices
    {
        Task Read();
        bool WriteSingle(object value, int address, int offset, int length, int count = 3);
        bool WriteClass<TClass>(TClass value, int address, int count = 3) where TClass : class;
        TValue? ReadSingle<TValue>(int address, int length, int count = 3);
        TClass? ReadClass<TClass>(int address, TClass obj = default, int count = 3) where TClass : class;

        bool Open();
        string Close();
    }
}
